/* stylelint-disable at-rule-no-unknown,at-rule-empty-line-before */
@import "../../../style/default";

/* apes-steps */
$steps-prefix-cls: #{$style-prefix}-steps;

@mixin step-item-status($status) {
  $icon-color: #{$status}-icon-color;
  $title-color: #{$status}-title-color;
  $description-color: #{$status}-description-color;
  $tail-color: #{$status}-tail-color;
  &-#{$status} &-icon {
    border-color: $icon-color;
    background-color: $steps-background;
    > .#{$steps-prefix-cls}-icon {
      color: $icon-color;
      .#{$steps-prefix-cls}-icon-dot {
        background: $icon-color;
      }
    }
  }
  &-#{$status} > &-content > &-title {
    color: $title-color;
    &:after {
      background-color: $tail-color;
    }
  }
  &-#{$status} > &-content > &-description {
    color: $description-color;
  }
  &-#{$status} > &-tail:after {
    background-color: $tail-color;
  }
}


.#{$steps-prefix-cls} {
  @include reset-component;
  font-size: 0;
  width: 100%;
  display: flex;
}

.#{$steps-prefix-cls}-item {
  position: relative;
  display: inline-block;
  vertical-align: top;
  flex: 1;
  overflow: hidden;

  &:last-child {
    flex: none;
  }

  &:last-child &-tail,
  &:last-child &-title:after {
    display: none;
  }

  &-icon,
  &-content {
    display: inline-block;
    vertical-align: top;
  }

  &-icon {
    border: $border-width-base $border-style-base $wait-icon-color;
    width: $steps-icon-size;
    height: $steps-icon-size;
    line-height: $steps-icon-size;
    text-align: center;
    border-radius: $steps-icon-size;
    font-size: $font-size-lg;
    margin-right: 8px;
    transition: background-color .3s, border-color .3s;
    font-family: $font-family-no-number;

    > .#{$steps-prefix-cls}-icon {
      line-height: 1;
      top: -1px;
      color: $primary-color;
      position: relative;
    }
  }
  &-tail {
    position: absolute;
    left: 0;
    width: 100%;
    top: 12px;
    padding: 0 10px;
    &:after {
      content: '';
      display: inline-block;
      background: $border-color-split;
      height: 1px;
      border-radius: 1px;
      width: 100%;
      transition: background .3s;
    }
  }
  &-title {
    font-size: $font-size-lg;
    color: $text-color;
    display: inline-block;
    padding-right: 16px;
    position: relative;
    line-height: $steps-icon-size;
    &:after {
      content: '';
      height: 1px;
      width: 9999px;
      background: $wait-tail-color;
      display: block;
      position: absolute;
      top: $steps-icon-size / 2;
      left: 100%;
    }
  }
  &-description {
    font-size: $font-size-base;
    color: $text-color-secondary;
  }
  @include step-item-status(wait);
  @include step-item-status(process);
  &-process &-icon {
    background: $process-icon-color;
    > .#{$steps-prefix-cls}-icon {
      color: $process-icon-text-color;
    }
  }
  &-process &-title {
    font-weight: 500;
  }
  @include step-item-status(finish);
  @include step-item-status(error);
  &-string &-icon,&-stringMore &-icon, &-stringProcess &-icon, &-stringWait &-icon {
    font-size: 12px;
    height: 35px;
    width: 35px;

    > .#{$steps-prefix-cls}-icon {
      > span {
        height: 33px;
        white-space: normal;
        display: flex;
        justify-content: center;
        align-items: center;
        margin: auto;
      }
    }
  }
  &-string &-icon {
    background: $process-icon-color;
    border-color: $process-icon-color;
    > .#{$steps-prefix-cls}-icon {
      color: $process-icon-text-color;
    }
  }
  &-stringProcess &-icon {
    background: $error-icon-color;
    border-color: $error-icon-color;
    > .#{$steps-prefix-cls}-icon {
      color: $process-icon-text-color;
    }
  }
  &-stringWait &-icon {
    border-color: $wait-icon-color;
  }
  &-string &-content,&-stringMore &-content, &-stringProcess &-content, &-stringWait &-content {
    display: block;
    .#{$steps-prefix-cls}-item-title {
      line-height: 25px;
      min-width: 100px;
      font-size: 14px;
      &:after {
        height: 2px;
        top: -20px;
        left: 50%;
      }
    }
    .#{$steps-prefix-cls}-item-description {
      font-size: 13px;
    }
  }
  &-string &-content{
     .#{$steps-prefix-cls}-item-title {
       &:after {
         background:$process-icon-color;
       }
     }
   }
  &-stringProcess &-content{
    .#{$steps-prefix-cls}-item-title {
      &:after {
        background:$error-icon-color;
      }
    }
  }
  &-stringWait &-content{
    .#{$steps-prefix-cls}-item-title {
      &:after {
        background:$wait-icon-color;
      }
    }
  }

  &.#{$steps-prefix-cls}-next-error .#{$steps-prefix-cls}-item-title:after {
    background: $error-icon-color;
  }
}

.#{$steps-prefix-cls}-horizontal:not(.#{$steps-prefix-cls}-label-vertical) {
  .#{$steps-prefix-cls}-item {
    margin-right: 16px;
    white-space: nowrap;
    &:last-child {
      margin-right: 0;
    }
    &:last-child .#{$steps-prefix-cls}-item-title {
      padding-right: 0;
    }
    &-tail {
      display: none;
    }
    &-description {
      max-width: $steps-desciption-max-width;
    }
  }
}
